package com.yoda.controller;


import com.yoda.dto.GetDto;
import com.yoda.dto.ListDto;
import com.yoda.vo.DataPage;
import com.yoda.result.Result;
import com.yoda.service.IYddLinkService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author itcast
 * @since 2023-05-15
 */
@RestController
@RequestMapping("/ydd_link")
public class YddLinkController   {

    @Autowired
    private IYddLinkService iYddLinkService;

    /**
     * 链接详情
     */
    @GetMapping("/rowInfo")
    public Result get(Integer id){
      return  iYddLinkService.get(id);
    }

    /**
     * 链接修改
     * @return
     */
    @PostMapping("/update")
    public Result getupdate(@RequestBody GetDto dto){
       return iYddLinkService.getupdate(dto);
    }

    /**
     *GET 链接删除
     * @param
     */
    @GetMapping("/del")
    public Result del(String id){
        iYddLinkService.del(id);
        return Result.success();
    }

    /**
     *  链接添加
     * @param dto
     */
    @PostMapping("/add")
    public Result save(@RequestBody GetDto dto){
       iYddLinkService.save(dto);
        return Result.success();
    }

    /**
     * 链接列表
     *
     * @return
     */
    @GetMapping("/list")
    public Result<DataPage> give(ListDto dto){
        DataPage dataPage = iYddLinkService.give(dto);
       return Result.success(dataPage) ;
    }

}

